﻿// Type: Telerik.Windows.Controls.RadMap
// Assembly: Telerik.Windows.Controls.DataVisualization, Version=2012.1.215.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
// Assembly location: C:\Program Files (x86)\Telerik\RadControls for Silverlight Q1 2012\Binaries\Silverlight\Telerik.Windows.Controls.DataVisualization.dll

using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Telerik.Windows;
using Telerik.Windows.Controls.Map;

namespace Telerik.Windows.Controls
{
    /// <summary>
    /// Represents the RadMap class.
    /// 
    /// </summary>
    [TemplatePart(Name = "PART_MapZoomBar", Type = typeof (MapZoomBar))]
    [TemplatePart(Name = "PART_MasterImage", Type = typeof (MultiScaleImage))]
    [TemplatePart(Name = "PART_TilesVisualizationLayer", Type = typeof (TilesVisualizationLayer))]
    [TemplatePart(Name = "PART_MouseControl", Type = typeof (MouseControl))]
    [TemplatePart(Name = "PART_MapScale", Type = typeof (MapScale))]
    [TemplatePart(Name = "PART_MapMouseLocationIndicator", Type = typeof (MapMouseLocationIndicator))]
    [TemplatePart(Name = "PART_MapNavigation", Type = typeof (MapNavigation))]
    [TelerikToolboxCategory("Visualization")]
    [TemplatePart(Name = "PART_MapCommandBar", Type = typeof (MapCommandBar))]
    [TemplatePart(Name = "PART_LayoutRoot", Type = typeof (Grid))]
    [TemplatePart(Name = "PART_DefaultLayoutDecorator", Type = typeof (Border))]
    [TemplatePart(Name = "PART_DefaultLayoutInnerDecorator", Type = typeof (Border))]
    [ContentProperty("Items")]
    public class RadMap : Telerik.Windows.Controls.ItemsControl
    {
        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.Provider"/> Provider dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ProviderProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.Providers"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ProvidersProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.Center"/> Center dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty CenterProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.ZoomLevel"/> ZoomLevel dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ZoomLevelProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.DistanceUnit"/> DistanceUnit dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty DistanceUnitProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.GeoBounds"/> GeoBounds dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty GeoBoundsProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.GeoBoundsNW"/> GeoBoundsNW dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty GeoBoundsNWProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.GeoBoundsSE"/> GeoBoundsSE dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty GeoBoundsSEProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.IsMouseWheelZoomEnabled"/> IsMouseWheelZoomEnabled dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty IsMouseWheelZoomEnabledProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.IsKeyboardNavigationEnabled"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty IsKeyboardNavigationEnabledProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.CommandBarVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty CommandBarVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MaxZoomLevel"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MaxZoomLevelProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MinZoomLevel"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MinZoomLevelProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MouseLocationIndicatorVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MouseLocationIndicatorVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.NavigationVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty NavigationVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.ScaleVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ScaleVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.ZoomBarDropDownHeight"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ZoomBarDropDownHeightProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.ZoomBarVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ZoomBarVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.ZoomBarPresetsVisibility"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty ZoomBarPresetsVisibilityProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MouseDragMode"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MouseDragModeProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MouseClickMode"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MouseClickModeProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.MouseDoubleClickMode"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty MouseDoubleClickModeProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.UseDefaultLayout"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty UseDefaultLayoutProperty;

        /// <summary>
        /// Identifies the <see cref="P:Telerik.Windows.Controls.RadMap.UseSpringAnimations"/> dependency property.
        /// 
        /// </summary>
        public static readonly DependencyProperty UseSpringAnimationsProperty;

        /// <summary>
        /// Identifies the MapMouseClick routed event.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly Telerik.Windows.RoutedEvent MapMouseClickEvent;

        /// <summary>
        /// Identifies the MapMouseDoubleClick routed event.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly Telerik.Windows.RoutedEvent MapMouseDoubleClickEvent;

        /// <summary>
        /// Identifies the PanningFinished routed event.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly Telerik.Windows.RoutedEvent PanningFinishedEvent;

        /// <summary>
        /// Identifies the ZoomingFinished routed event.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly Telerik.Windows.RoutedEvent ZoomingFinishedEvent;

        /// <summary>
        /// Initializes a new instance of the RadMap class.
        /// 
        /// </summary>
        public RadMap();

        /// <summary>
        /// Dispose all resources are used by RadMap control.
        /// 
        /// </summary>
        public void Dispose();

        /// <summary>
        /// Detect whether given location is visible in the map control.
        /// 
        /// </summary>
        /// <param name="location"/>
        /// <returns/>
        public bool IsVisible(Location location);

        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate.
        /// 
        /// </summary>
        public override void OnApplyTemplate();

        /// <summary>
        /// Calculates degree size according to base point and zoom.
        /// 
        /// </summary>
        /// <param name="basePoint">Base point.</param><param name="pixelSize">The size in pixels.</param>
        /// <returns>
        /// Size in degree.
        /// </returns>
        public Size GetGeoSize(Location basePoint, Size pixelSize);

        /// <summary>
        /// Calculates degree size according to base point and zoom.
        /// 
        /// </summary>
        /// <param name="basePoint">Base point.</param><param name="width">The width in units according to DistanceUnit property.</param><param name="height">The height in units according to DistanceUnit property.</param>
        /// <returns>
        /// Size in degree.
        /// </returns>
        public Size GetLatitudeLongitudeSize(Location basePoint, double width, double height);

        /// <summary>
        /// Calculates pixel size according to base point and zoom.
        /// 
        /// </summary>
        /// <param name="basePoint">Base point.</param><param name="width">The width in units according to DistanceUnit property.</param><param name="height">The height in units according to DistanceUnit property.</param>
        /// <returns>
        /// Size in pixels.
        /// </returns>
        public Size GetPixelSize(Location basePoint, double width, double height);

        /// <summary>
        /// Calculates horizontal pixel distance according to latitude and zoom.
        /// 
        /// </summary>
        /// <param name="distance">The distance in units according to DistanceUnit property.</param>
        /// <returns>
        /// Horizontal distance in pixels.
        /// </returns>
        public double GetPixelsDistance(double distance);

        /// <summary>
        /// Refresh default command bar regardles whether map provider has been changed or not.
        /// 
        /// </summary>
        public void RefreshCommandBar();

        /// <summary>
        /// Sets ZoomLevel and Center so the given LocationRect object is completely visible.
        /// 
        /// </summary>
        public void SetView(LocationRect view);

        /// <summary>
        /// Called to arrange and size the content.
        /// 
        /// </summary>
        /// <param name="finalSize">The computed size that is used to arrange the content.</param>
        /// <returns>
        /// The calculated size.
        /// </returns>
        protected override Size ArrangeOverride(Size finalSize);

        /// <summary>
        /// Prepares the specified element to display the specified item.
        /// 
        /// </summary>
        /// <param name="element">Element used to display the specified item.</param><param name="item">Specified item.</param>
        [Description("Prepares the specified element to display the specified item.")]
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item);

        /// <summary>
        /// Invoked when the Items property changes.
        /// 
        /// </summary>
        /// <param name="e">Information about the change.</param>
        protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e);

        /// <summary>
        /// Gets or sets coma-separated list of the UI commands are allowed.
        ///             Following commands are currently supported:
        ///             Road, Aerial, Birdseye, IsLabelVisible.
        ///             Null pointer or empty string indicates that all commands are allowed.
        ///             "None" indicates that all commands are disabled.
        /// 
        /// </summary>
        [Obsolete("The AllowedCommands is obsolete. Use Commands property of the corresponding map provider and IsAllowed property of the desired command to control command availability.")]
        public string AllowedCommands { get; set; }

        /// <summary>
        /// Gets or sets center of the map.
        /// 
        /// </summary>
        public Location Center { get; set; }

        /// <summary>
        /// Gets bounds of the geographical region covered by map control.
        /// 
        /// </summary>
        public Rect GeographicalBounds { get; }

        /// <summary>
        /// Gets value which indicates whether map control have been initialized.
        /// 
        /// </summary>
        public bool IsInitialized { get; }

        /// <summary>
        /// Gets LocationRect of the geographical region covered by map control.
        /// 
        /// </summary>
        public LocationRect LocationRect { get; }

        /// <summary>
        /// Get or sets map provider.
        /// 
        /// </summary>
        public MapProviderBase Provider { get; set; }

        /// <summary>
        /// Gets collection of the map image providers.
        /// 
        /// </summary>
        public MapProviderCollection Providers { get; }

        /// <summary>
        /// Gets or sets current Spatial Reference of the Map control.
        /// 
        /// </summary>
        public ISpatialReference SpatialReference { get; set; }

        /// <summary>
        /// Gets or sets zoom level.
        /// 
        /// </summary>
        public int ZoomLevel { get; set; }

        /// <summary>
        /// Gets or sets distance unit.
        /// 
        /// </summary>
        public DistanceUnit DistanceUnit { get; set; }

        /// <summary>
        /// Gets or sets map geographical bounds.
        /// 
        /// </summary>
        /// 
        /// <remarks>
        /// You can't use ths property to set bounds at the same time with
        ///             GeoBoundsNW and GeoBoundsSE properties.
        /// 
        /// </remarks>
        public LocationRect GeoBounds { get; set; }

        /// <summary>
        /// Gets or sets north-west corner of the map geographical bounds.
        /// 
        /// </summary>
        /// 
        /// <remarks>
        /// You can't use ths property to set bounds at the same time with
        ///             GeoBounds property.
        /// 
        /// </remarks>
        public Location GeoBoundsNW { get; set; }

        /// <summary>
        /// Gets or sets south-east corner of the map geographical bounds.
        /// 
        /// </summary>
        /// 
        /// <remarks>
        /// You can't use ths property to set bounds at the same time with
        ///             GeoBounds property.
        /// 
        /// </remarks>
        public Location GeoBoundsSE { get; set; }

        /// <summary>
        /// Gets or sets value which indicates whether mouse weel can be used to zoom map in-out.
        /// 
        /// </summary>
        public bool IsMouseWheelZoomEnabled { get; set; }

        /// <summary>
        /// Gets or sets value which indicates whether keyboard can be used to navigate over the map.
        /// 
        /// </summary>
        public bool IsKeyboardNavigationEnabled { get; set; }

        /// <summary>
        /// Gets or sets visibility of the embedded MapCommandBar UI control.
        /// 
        /// </summary>
        public Visibility CommandBarVisibility { get; set; }

        /// <summary>
        /// Gets the default zoom control.
        /// 
        /// </summary>
        /// 
        /// <value>
        /// The map zoom panel.
        /// </value>
        public MapZoomBar MapZoomBar { get; }

        /// <summary>
        /// Gets or sets maximum ZoomLevel.
        /// 
        /// </summary>
        public int MaxZoomLevel { get; set; }

        /// <summary>
        /// Gets or sets minimum ZoomLevel.
        /// 
        /// </summary>
        public int MinZoomLevel { get; set; }

        /// <summary>
        /// Gets or sets visibility of the embedded MouseLocationIndicator UI control.
        /// 
        /// </summary>
        public Visibility MouseLocationIndicatorVisibility { get; set; }

        /// <summary>
        /// Gets or sets visibility of the embedded MapNavigation UI control (the arrows navigation).
        /// 
        /// </summary>
        public Visibility NavigationVisibility { get; set; }

        /// <summary>
        /// Gets or sets height of the embedded MapZoomBar drop down.
        /// 
        /// </summary>
        public double ZoomBarDropDownHeight { get; set; }

        /// <summary>
        /// Gets or sets visibility of the embedded MapZoomBar UI control.
        /// 
        /// </summary>
        public Visibility ZoomBarVisibility { get; set; }

        /// <summary>
        /// Gets or sets the visibility of the MapZoomBar preset buttons that zoom to predefined levels on the map (World, State, Region, City, Hood).
        /// 
        /// </summary>
        public Visibility ZoomBarPresetsVisibility { get; set; }

        /// <summary>
        /// Gets or sets the content of the MapZoomBar preset buttons that zoom to predefined levels on the map (World, State, Region, City, Hood).
        /// 
        /// </summary>
        /// 
        /// <value>
        /// The zoom bar presets settings.
        /// </value>
        [Obsolete("The ZoomBarPresetsSettings property is obsolete. Use Command.Text property for the correspondent zoom level command in the RadMap.MapZoomBar.Commands collection.")]
        public MapZoomBarPresetsSettings ZoomBarPresetsSettings { get; set; }

        /// <summary>
        /// Gets or sets visibility of the embedded MapScale UI control.
        /// 
        /// </summary>
        public Visibility ScaleVisibility { get; set; }

        /// <summary>
        /// Gets or sets Mouse Drag Mode property.
        /// 
        /// </summary>
        public MouseDragBehavior MouseDragMode { get; set; }

        /// <summary>
        /// Gets or sets Mouse Click Mode property.
        /// 
        /// </summary>
        public MouseBehavior MouseClickMode { get; set; }

        /// <summary>
        /// Gets or sets Mouse Double Click Mode property.
        /// 
        /// </summary>
        public MouseBehavior MouseDoubleClickMode { get; set; }

        /// <summary>
        /// Gets or sets value which indicates whether map control should use default layout for navigation and map mode controls.
        /// 
        /// </summary>
        public bool UseDefaultLayout { get; set; }

        /// <summary>
        /// Gets or sets value which indicates whether spring animations are enabled.
        /// 
        /// </summary>
        public bool UseSpringAnimations { get; set; }

        /// <summary>
        /// Event occurs when initialization of the map control is completed.
        /// 
        /// </summary>
        public event EventHandler InitializeCompleted;

        /// <summary>
        /// Event occurs when the Center property of the map control is changed.
        /// 
        /// </summary>
        public event EventHandler CenterChanged;

        /// <summary>
        /// Event occurs when the Center property of the map control starts to change.
        /// 
        /// </summary>
        public event EventHandler<Telerik.Windows.Controls.Map.PropertyChangingEventArgs> CenterChanging;

        /// <summary>
        /// Event occurs when the Zoom property of the map control is changed.
        /// 
        /// </summary>
        public event EventHandler ZoomChanged;

        /// <summary>
        /// Event occurs when the ZoomLevel property of the map control starts to change.
        /// 
        /// </summary>
        public event EventHandler<Telerik.Windows.Controls.Map.PropertyChangingEventArgs> ZoomChanging;

        /// <summary>
        /// Occurs when the user clicks on the map.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event MouseRoutedEventHandler MapMouseClick;

        /// <summary>
        /// Occurs when the user does double click on the map.
        /// 
        /// </summary>
        [SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event MouseRoutedEventHandler MapMouseDoubleClick;

        /// <summary>
        /// Event occurs when panning of the map finished
        ///             (spring animation which started when map center has been changed is finished).
        /// 
        /// </summary>
        public event RoutedEventHandler PanningFinished;

        /// <summary>
        /// Event occurs when zooming of the map finished
        ///             (spring animation which started when map zoom level has been changed is finished).
        /// 
        /// </summary>
        public event RoutedEventHandler ZoomingFinished;
    }
}
